Minimizing flakiness of dispatcher_test.rb
#678
Merged
+14
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: #602
Flake reference: https://github.com/rails/solid_queue/blob/main/test/unit/dispatcher_test.rb
Failed run: https://github.com/rails/solid_queue/actions/runs/18917303921/job/54003968729
Summary
polling queries are logged— RewindStringIOand increase sleeppolling queries can be silenced— RewindStringIOand increase sleepsilencing polling queries when there's no Active Record logger— Increase sleeprun more than one instance of the dispatcher— IncreaseAddToBufferJobwait and increase sleepsleeps 0.seconds between polls if there are ready to dispatch jobs— IncreaseAddToBufferJobwait and increase sleepWhile the CI logs helped diagnose flakes in tests 1 and 2, the following command was useful to reproduce others locally:
You might also need to add
TEST_ENV_NUMBERtodatabase.yml:And also modify the log path for
environments/test.rb: